package collection;

import java.util.*;

public class Practice {
    public static void main(String[] args) {
       /* Collection<String> a=new ArrayList<>();
        a.add("zz");
        a.add("xx");
        a.add("cc");
        a.add("vv");
        a.add("bb");
        System.out.println("a:"+a);

        Collection<String> a2=new ArrayList<>();
        a2.add("qq");
        a2.add("ww");
        a2.add("ee");
        System.out.println("a2:"+a2);

        a.addAll(a2);
        System.out.println("a:"+a);

        Collection<String> a3=new ArrayList<>();
        a3.add("cc");
        a3.add("qq");
        a3.add("kk");
        System.out.println("a3:"+a3);

        boolean w=a.contains(a3);
        System.out.println(w);

        //a.retainAll(a3);
        //System.out.println(a);

        a.removeAll(a3);
        System.out.println(a);*/


        Collection<String> b=new ArrayList<>();
        b.add("a");
        b.add("#");
        b.add("b");
        b.add("#");
        b.add("c");
        b.add("#");
        b.add("d");
        b.add("#");
        b.add("e");
        b.add("#");
        System.out.println(b);
        Iterator<String> t=b.iterator();
        while (t.hasNext()) {
            String y = t.next();
            System.out.println(y);

            if ("#".equals(y)) {
                t.remove();
            }
        }
            System.out.println(b);



        String[] arr= {"11","22","33","55"};
        for (String o:arr){
            System.out.println(o);
        }
        for (Object p:b){
            System.out.println(p);
        }

        Collection<Point> pp=new ArrayList<>();
        pp.add(new Point(2,3));
        pp.add(new Point(4,5));
        pp.add(new Point(6,7));
        pp.add(new Point(8,9));
        pp.add(new Point(10,11));
        Iterator<Point> tt=pp.iterator();
        while (tt.hasNext()){
            Point cc=tt.next();
            System.out.println(cc);
        }
        for (Point ii:pp){
            System.out.println(ii);
        }







       /* Collection<String> ll=new ArrayList<>();
        ll.add("one");
        ll.add("two");
        ll.add("three");
        ll.add("four");
        ll.add("five");
        System.out.println(ll);

        String[] rrt=ll.toArray(new String[9]);
        System.out.println(Arrays.toString(rrt));*/



        String[] ttr={"one","two","three","four","five"};
        System.out.println(Arrays.toString(ttr));
        List<String> list=Arrays.asList(ttr);
        System.out.println(list);



        ttr[2]="o";
        System.out.println(list);
        System.out.println(Arrays.toString(ttr));

        list.set(3,"p");
        System.out.println(list);
        System.out.println(Arrays.toString(ttr));

    }
}
